home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-07-15 | 3.4 KB | 64 lines | [TEXT/KAHL] |
- TakeScreenShot Read Me File
-
- 7-1-92 - Brigham Stevens
- Apple Computer Developer Technical Support
-
- Normally, MacsBug or will not allow you to take a screen shot of your application's screen while
- you are in the debugger. However, it is possible to work around this by adding a function to your
- program that takes a screen shot. You can jump directly to this function from anywhere in your
- program using MacsBug commands and take a screen shot, and then continue with normal program
- execution.
-
- This is especially useful to capture frames of an animation sequence when WaitNextEvent,
- or GetNextEvent are not called.
-
- Just include the function TakeScreenShot (in TakeScreenShot.c) in your code, and build your project
- with full MacsBug symbols on. This function uses the built in screen shot FKEY to take a screen
- shot to disk whenever it is called, at any time. This will also save you the time in writing code
- to create a PICT file of the screen, because this uses the standard System screen shot FKEY.
-
- Since the code will be executing as part of your application, MacsBug will have restored the
- screen, and also enabled interrupts, so you can take a screen shot and write to the disk.
-
- When you are in the debugger and want to take a screen shot, enter in these commands:
-
- mc savePC PC
- g TakeScreenShot
-
- This will put the value of the PC into a macro named savePC, and jump to the code in your
- application which loads the Screen Shot FKEY (FKEY id = 3) and performs a jsr to it.
- This causes a screen shot to be taken and a file created, named Picture XX, just as if you had
- pressed cmd-shift-3. The last line of the function TakeScreenShot is a DebugStr.
-
- This DebugStr will be interpreted as MacsBug commands to step over the next 2 instructions,
- which would be a movem to restore the registers used, and also an unlk to restore the stack,
- and then set the PC to the saved value. (In other words, you forego the RTS, which would cause
- you to jump into never never land) This leaves the stack in the state it was in before you
- jumped to TakeScreenShot. It is VERY important to set the MacsBug Macro to the program counter
- before jumping to the TakeScreenShot function.
-
- You can also call the TakeScreenShot function directly from your code, which will work just fine,
- if you take out the last DebugStr, or set up a DebugStr before you call it that sets the savePC
- macro to the right address.
-
- To simplify the use of this, you can create a macro that sets up the macro savePC and also
- jumps to the TakeScreenShot routine.
-
- MC ScreenShot 'mc savePC PC; g TakeScreenShot'
-
- Then, whenever you want a screen shot from MacsBug, type in screenShot, and viola, you get one.
- You can also add this to the DebuggerPrefs resource file with ResEdit, to add the Macro
- permanently. This means changing or adding a resource of type 'mxbm'. The resource file
- "TakeScreenShot MacsBug Macros" is already set up. Just copy this into your DebuggerPrefs file,
- and then you can take screenshots by simply typing in ScreenShot within MacsBug.
-
- One thing that could be done to improve this, is to
- rename the file from 'Picture 0' to something else, so that you can take as many screen shots as
- needed without having to go to the Finder to rename them manually.
-
- Feel free to send any comments, suggestions for improvement, improved versions, or general abuse.
-
- - Brigham Stevens
-
- AppleLink: BRIGHAM
- Internet: brigham@applelink.apple.com